package me.zhengjie.tools.service

import me.zhengjie.tools.domain.AlipayConfig
import me.zhengjie.tools.domain.vo.TradeVo


/**
 * @author Kuki Wu
 * @date 2018-12-31
 */
interface AlipayService {
    /**
     * 处理来自PC的交易请求
     * @param alipay 支付宝配置
     * @param trade 交易详情
     * @return String
     * @throws Exception 异常
     */
    @Throws(Exception::class)
    fun toPayAsPC(alipay: AlipayConfig?, trade: TradeVo?): String?

    /**
     * 处理来自手机网页的交易请求
     * @param alipay 支付宝配置
     * @param trade 交易详情
     * @return String
     * @throws Exception 异常
     */
    @Throws(Exception::class)
    fun toPayAsWeb(alipay: AlipayConfig?, trade: TradeVo?): String?

    /**
     * 查询配置
     * @return AlipayConfig
     */
    fun find(): AlipayConfig?

    /**
     * 更新配置
     * @param alipayConfig 支付宝配置
     * @return AlipayConfig
     */
    fun update(alipayConfig: AlipayConfig?): AlipayConfig?
}